package com.warrior.entity;

import javax.persistence.*;
import java.sql.Timestamp;

/**
 * Created by Shawn on 2017/3/13.
 */
@Entity
@Table(name = "user", schema = "warrior")
public class UserEntity {
    private String id; //用户id主键,使用U-uuid拼接完成
    private String userName;//用户名记录字段
    private String mobile;//记录用户手机号字段
    private String wxChatToken;//记录微信登陆使用的微信登陆信息
    private String nickname;//记录微信登陆使用的微信登陆信息
    private Integer isCaption;//记录是否为队长标识,0表示队员,1表示队长
    private String userLocalPicPath;//记录用户本地头像信息
    private String userWxPicPath;//用户微信头像地址
    private String userWxNickname;//记录微信回调的用户昵称信息
    private Integer userStatus;//记录用户的状态 0表示未激活
    private Timestamp createdAt; //记录该条记录的创建时间
    private Timestamp updateAt; //记录该条记录的更新时间
    private String createdBy; //记录该条记录的创建者
    private String updateBy; //记录该条记录由何人更新
    private TeamEntity teamEntity; //记录队伍id,用TE-40位uuid表示
    private String idCardPicPath;//证件上传位置

    @Id
    @Column(name = "id")
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    @Basic
    @Column(name = "user_name")
    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    @Basic
    @Column(name = "mobile")
    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    @Basic
    @Column(name = "wx_chat_token")
    public String getWxChatToken() {
        return wxChatToken;
    }

    public void setWxChatToken(String wxChatToken) {
        this.wxChatToken = wxChatToken;
    }

    @Basic
    @Column(name = "nickname")
    public String getNickname() {
        return nickname;
    }

    public void setNickname(String nickname) {
        this.nickname = nickname;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        UserEntity that = (UserEntity) o;

        if (id != null ? !id.equals(that.id) : that.id != null) return false;
        if (userName != null ? !userName.equals(that.userName) : that.userName != null) return false;
        if (mobile != null ? !mobile.equals(that.mobile) : that.mobile != null) return false;
        if (wxChatToken != null ? !wxChatToken.equals(that.wxChatToken) : that.wxChatToken != null) return false;
        if (nickname != null ? !nickname.equals(that.nickname) : that.nickname != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = id != null ? id.hashCode() : 0;
        result = 31 * result + (userName != null ? userName.hashCode() : 0);
        result = 31 * result + (mobile != null ? mobile.hashCode() : 0);
        result = 31 * result + (wxChatToken != null ? wxChatToken.hashCode() : 0);
        result = 31 * result + (nickname != null ? nickname.hashCode() : 0);
        return result;
    }

    @Basic
    @Column(name = "is_caption")
    public Integer getIsCaption() {
        return isCaption;
    }

    public void setIsCaption(Integer isCaption) {
        this.isCaption = isCaption;
    }

    @Basic
    @Column(name = "user_local_pic_path")
    public String getUserLocalPicPath() {
        return userLocalPicPath;
    }

    public void setUserLocalPicPath(String userLocalPicPath) {
        this.userLocalPicPath = userLocalPicPath;
    }

    @Basic
    @Column(name = "user_wx_pic_path")
    public String getUserWxPicPath() {
        return userWxPicPath;
    }

    public void setUserWxPicPath(String userWxPicPath) {
        this.userWxPicPath = userWxPicPath;
    }

    @Basic
    @Column(name = "user_wx_nickname")
    public String getUserWxNickname() {
        return userWxNickname;
    }

    public void setUserWxNickname(String userWxNickname) {
        this.userWxNickname = userWxNickname;
    }

    @Basic
    @Column(name = "user_status")
    public Integer getUserStatus() {
        return userStatus;
    }

    public void setUserStatus(Integer userStatus) {
        this.userStatus = userStatus;
    }

    @Basic
    @Column(name = "created_at")
    public Timestamp getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(Timestamp createdAt) {
        this.createdAt = createdAt;
    }

    @Basic
    @Column(name = "update_at")
    public Timestamp getUpdateAt() {
        return updateAt;
    }

    public void setUpdateAt(Timestamp updateAt) {
        this.updateAt = updateAt;
    }

    @Basic
    @Column(name = "created_by")
    public String getCreatedBy() {
        return createdBy;
    }

    public void setCreatedBy(String createdBy) {
        this.createdBy = createdBy;
    }

    @Basic
    @Column(name = "update_by")
    public String getUpdateBy() {
        return updateBy;
    }

    public void setUpdateBy(String updateBy) {
        this.updateBy = updateBy;
    }

    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "team_id", referencedColumnName = "id")
    public TeamEntity getTeamEntity() {
        return teamEntity;
    }

    public void setTeamEntity(TeamEntity teamEntity) {
        this.teamEntity = teamEntity;
    }

    @Basic
    @Column(name = "id_card_pic_path")
    public String getIdCardPicPath() {
        return idCardPicPath;
    }

    public void setIdCardPicPath(String idCardPicPath) {
        this.idCardPicPath = idCardPicPath;
    }
}
